
.PHONY: all apr native clean deps

all: apr native
	install -m 755 server.xml /etc/tomcat6/	
	install -m 755 setenv.sh /usr/share/tomcat6/bin/

clean:
	rm -r apr-1.4.5.tar.gz tomcat-native-1.1.20-src.tar.gz 
	rm -r apr-1.4.5/ tomcat-native-1.1.20-src/

deps:
	sudo apt-get install libssl-dev libapr1-dev openjdk-6-jdk 	

apr-1.4.5.tar.gz:
	wget http://tweedo.com/mirror/apache/apr/apr-1.4.5.tar.gz

apr: deps apr-1.4.5.tar.gz
	tar -xzpf apr-1.4.5.tar.gz
	cd apr-1.4.5/ ; ./configure
	make -C apr-1.4.5 ; sudo make -C apr-1.4.5 install

tomcat-native-1.1.20-src.tar.gz:
	wget http://www.apache.org/dist/tomcat/tomcat-connectors/native/1.1.20/source/tomcat-native-1.1.20-src.tar.gz

native: deps tomcat-native-1.1.20-src.tar.gz
	tar -xzpf tomcat-native-1.1.20-src.tar.gz
	cd tomcat-native-1.1.20-src/jni/native ; ./configure --with-apr=/usr/local/apr --with-java-home=/usr/lib/jvm/java-6-openjdk/
	make -C tomcat-native-1.1.20-src/jni/native
	sudo make -C tomcat-native-1.1.20-src/jni/native install


